package com.sbtr.controller.system;

import com.sbtr.common.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.sbtr.exception.BDException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import com.sbtr.common.PageDto;
import com.sbtr.business.system.entity.HelpParam;
import com.sbtr.business.system.dto.HelpParamDto;
import com.sbtr.business.system.service.HelpParamService;
import org.springframework.web.bind.annotation.RestController;
import com.sbtr.controller.common.CommonController;

/**
 * 帮助说明参数字段列表 前端控制器
 *
 * @author dgl
 * @since 2023-07-19
 */
@RestController
@RequestMapping("/helpParam")
@Api(tags = "帮助说明参数字段列表")
public class HelpParamController extends CommonController<HelpParam,HelpParamService> {

    @GetMapping("/pageList")
    @ApiOperation(httpMethod = "GET", value = "分页列表")
    public Response<PageDto<HelpParam>> pageList(HelpParamDto helpParamDto){
        return Response.success(u.pageList(helpParamDto));
    }

    @PostMapping("/save")
    @ApiOperation(httpMethod = "POST", value = "保存")
    public Response<HelpParam> save(@RequestBody HelpParam helpParam){
        helpParam.setId(null);
        if(helpParam.insert()){
            return Response.success(helpParam);
        }else throw new BDException("保存失败");
    }

}

